package com.pkk.penguin.frame.know.java.driven.ext.processors.bean;

import static com.pkk.penguin.frame.know.java.driven.ext.processors.ProcessorsManinTests.printi;

import org.springframework.beans.factory.InitializingBean;

/**
 * 我的bean
 *
 * @author peikunkun
 * @version V1.0
 * @date 2020-11-20 17:47
 **/
public class MyBean implements InitializingBean {


  public MyBean() {
    printi("自定义BEAN构造方法执行");
  }


  public void init() {
    printi("自定义BEAN初始化方法执行");
  }


  public void destory() {
    printi("自定义BEAN销毁方法执行");
  }

  /**
   * Invoked by a BeanFactory after it has set all bean properties supplied
   * (and satisfied BeanFactoryAware and ApplicationContextAware).
   * <p>This method allows the bean instance to perform initialization only
   * possible when all bean properties have been set and to throw an
   * exception in the event of misconfiguration.
   *
   * @throws Exception in the event of misconfiguration (such
   * as failure to set an essential property) or if initialization fails.
   */
  @Override
  public void afterPropertiesSet() throws Exception {
    printi("自定义BEAN的InitializingBean.afterPropertiesSet()执行了");
  }
}
